package org.admanager.soa.plugin.wizard;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.URL;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourceAttributes;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
import org.admanager.soa.plugin.Activator;

public class NewSOADProjectWizard extends BasicNewProjectResourceWizard {

	public NewSOADProjectWizard() {
		// TODO Auto-generated constructor stub
	}

	@Override
	public boolean performFinish() {
		super.performFinish();
		// System.out.println("Test");
		IProject project = super.getNewProject();
		IFolder patternViewFolder = project.getFolder("PatternView");
		IFolder mappingFolder = project.getFolder("SCAMapping");
		IFolder SCAModelFolder = project.getFolder("SimplifiedSCA");
		IFolder patternFolder = project.getFolder("SOAPattern");

		try {
			ResourceAttributes ra = new ResourceAttributes();
			ra.setReadOnly(true);

			patternViewFolder.create(true, true, null);
			patternViewFolder.setResourceAttributes(ra);

			mappingFolder.create(true, true, null);
			mappingFolder.setResourceAttributes(ra);

			patternFolder.create(true, true, null);
			patternFolder.setResourceAttributes(ra);

			SCAModelFolder.create(true, true, null);
			SCAModelFolder.setResourceAttributes(ra);

		} catch (CoreException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return true;
	}
}
